//?????? ?????????? ?? ????? ??????????? ajax ???????
function ServerTable() {
	//Html TABLE element for output rows
	this.table=null;
	this.what="";
	//???????? ??????? ?? ???????
	this.from="";
	//Where ?????????. Example: "field1 = value1 & field2 = value2"
	//* - ?????????????? ???? 
	this.Filter="";
	//????????? ???? +name ??? -code
	this.Sort="";	
	this.AppendData=""; //???? ?? ????????
	//?????????? ??? ??????????? ???????
	this.getCount=function(){
		if (!this.table) return 0;
		return this.table.rows.length;	
	};
	this.objid="";
	//????????? ?? ???????,  
	//?????????? ????? ??????? 
	this.pump=null;
	//????????? ?? ???????,  
	//?????????? ??? ??????
	this.onreset=null; 
	
	//???????? ????????? ?????? ??????
	//? ???????
	//????????? ????? ?? csp ????????
	this.next=function() {
		//alert("table next");
		if (!this.pump) return;
		var html=this.pump(this); //?????? ??????? ??????
		this.objid=""; //?????
		this.appendHTML(html);
	}
	
	this.appendHTML=function(html){
		var buff=document.createElement("div");
		buff.innerHTML=html;
		var table=buff.firstChild;
		var tableBody=table.tBodies[0];
		this.table.appendChild(tableBody);
		delete buff;
	}
	//?????? ?????????? ???????
	this.Reset=function(){
		//alert("table reset");
		if (!this.table) return;
		var count=this.table.tBodies.length-1;
		for(var index=count;index>-1;index--){
		var body=this.table.tBodies[index];
			this.table.removeChild(body);
		}
		this.next();
		if (this.onreset) this.onreset();
	}
}
